package train;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class ALGO1 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> array = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			array.add(sc.nextInt());
		}

		int m = sc.nextInt();
		for (int i = 0; i < m; i++) {
			int l = sc.nextInt() - 1;
			int r = sc.nextInt() - 1;
			int k = sc.nextInt();
			int e = findKth(array, l, r, k);
			System.out.println(e);
		}
		sc.close();
	}

	private static int findKth(ArrayList<Integer> array, int l, int r, int k) {
		List<Integer> nums = array.subList(l, r + 1);
		nums.sort(new Comparator<Integer>() {
			@Override
			public int compare(Integer o1, Integer o2) {
				// TODO Auto-generated method stub
				return o2 - o1;
			}
		});

		return nums.get(k - 1);
	}
}
